package cn.lg.soar.flow.feign;

import cn.lg.soar.core.annotations.ApiClient;
import cn.lg.soar.flow.api.constant.ModuleConst;
import cn.lg.soar.flow.api.model.*;
import cn.lg.soar.flow.api.service.IFlowTaskApi;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.List;

/**
 * 文件上传接口
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@ConditionalOnMissingClass("cn.lg.soar.flow.biz.client.FlowTasApiClient")
@ApiClient
@FeignClient(
        name= ModuleConst.MODULE_NAME,
        path= ModuleConst.CLIENT_PATH + "/flow-task",
        fallbackFactory= FlowTaskApiFallbackFactory.class,
        contextId="FlowTaskApiFeign"
)
public interface FlowTaskApiFeign extends IFlowTaskApi {

    @PostMapping("startFlow")
    @Override
    FlowInfoDTO startFlow(@RequestBody StartFlowDTO startFlowDTO);

    @PostMapping("completeTask")
    @Override
    FlowInfoDTO completeTask(@RequestBody CompleteTaskDTO completeTaskDTO);

    @PostMapping("revoke")
    @Override
    void revoke(@RequestBody RevokeDTO revokeDTO);

    @GetMapping("approvalTasks")
    @Override
    List<ApprovalTaskDTO> approvalTasks(@RequestParam("userId") Long userId, @RequestParam("procInstId") String procInstId);

    @GetMapping("currentProcInstIds")
    @Override
    List<String> currentProcInstIds(@RequestParam("userId") Long userId, @RequestParam("flowCode") String flowCode);

    @GetMapping("currentTaskUserIds")
    @Override
    List<TaskInfoDTO> currentTaskUserIds(@RequestParam("procInstIds") Collection<String> procInstIds);

    @GetMapping("currentTasks")
    @Override
    List<TaskInfoDTO> currentTasks(@RequestParam("procInstIds") Collection<String> procInstIds);

    @GetMapping("auditLogList")
    @Override
    List<AuditLogDTO> auditLogList(@RequestParam("procInstId") String procInstId);

    @GetMapping("auditLogList2")
    @Override
    List<AuditLogDTO> auditLogList(@RequestParam("flowCode") String flowCode, @RequestParam("bizId") String bizId);

    @GetMapping("progress")
    @Override
    ProgressVO progress(@RequestParam("procInstId") String procInstId);

    @GetMapping("taskDetail")
    @Override
    TaskDetailDTO taskDetail(@RequestParam("taskId") String taskId);

}
